<h3 class="title">
	&nbsp;首页 &gt; <a href="<?=Base::adminUrl('zone', 'index');?>">区域管理</a> &gt; 列表
    <input type="button" style="float:right" onclick="location.href='<?=Base::adminUrl('zone', 'create', array('pid' => $pid));?>'" class="btn_c" value="添加区域" />
</h3>

<div class="tags">
  <div id="tagscontent">
    <div id="con_one_1">
      <div class="table_td">
        <form name="listform" id="listform" action="<?=Base::adminUrl('zone', 'batch');?>" method="post">
          <table border="0" cellspacing="2" cellpadding="4" class="formtable" name="table" id="table" width="100%">
            <thead>
              <tr>
                <th><input title="点击可全选本页的所有项目" onclick="CheckAll(this.form)" type="checkbox" name="chkall" class="checkbox" /></th>
                <th>排序</th>
                <th>编号</th>
                <th>名称</th>
                <th colspan="2">拼音字母</th>
                <th>区域类型</th>
                <th>显示</th>
                <th align="center">操作</th>
              </tr>
            </thead>
            <?php
				foreach($data as $item){
			?>
            <tbody>
              <tr>
                <td align="center"><input onClick="c_chang(this)" type="checkbox" value="<?=$item['zone_id'];?>" name="select[]" class="checkbox" /></td>
                <td align="center"><input type="text" name="list[<?=$item['zone_id'];?>][ordnum]" id="list-ordnum-<?=$item['zone_id'];?>" value="<?=$item['ordnum'];?>"  size=3/></td>
                <td align="center"><?=$item['zone_id'];?></td>
                <td align="left"><?=h($item['name']);?></td>
                <td align="center"><?=$item['letter'];?>&nbsp;</td>
                <td align="left"><?=h($item['ename']);?></td>
                <td align="center"><?=get_zone_type($item['zone_type']);?></td>
                <td align="center"><? if($item['display']){ ?><font color="Green">√</font><? }else{ ?><font color="Red">×</font><? } ?></td>
                <td align="center">
                	<?php if($item['parent_id'] == 0){ ?>
                		<a href="<?=Base::adminUrl('zone', 'index', array('pid' => $item['zone_id']));?>">进入子类</a> |
                    <?php }else{ ?>
                    	&nbsp;
					<?php } ?>
						<a href="<?=Base::adminUrl('zone', 'modify', array('zone_id' => $item['zone_id']));?>">编辑</a>
                    </td>
              </tr>
              <?php
				}
			  ?>
            </tbody>
          </table>

          <div class="blank10"></div>
          <input type="hidden" name="action" id="action" value="">
          <input type="hidden" name="pid" value="<?=intval($pid);?>">
          <input type="button" value=" 排序 " name="update" onClick="if(getSelect(this.form) && confirm('确实要排序ID为('+getSelect(this.form)+')的记录吗?')){$('#action').val('sort');$('#listform').submit();}" class="button" />
          <input type="button" value=" 删除 " name="delete" onClick="if(getSelect(this.form) && confirm('确实要删除ID为('+getSelect(this.form)+')的记录吗?')){$('#action').val('delete');$('#listform').submit();}" class="button" />
			&nbsp; | &nbsp;
          <input type="button" value=" 更新缓存 " name="change" onClick="if(confirm('确实要更新区域缓存吗?')){location.href='<?=Base::AdminUrl('util', 'cacheZone');?>'}" class="button" />

          <div class="blank10"></div>
        </form>
        <div class="page">
	        <?=$pagestring;?>
        </div>
        <div class="clear"></div>
      </div>
      <div id="con_one_2"></div>
    </div>
  </div>
</div>


<?php
	function get_zone_type($zonetype){
		static $zoneTypes;
		if(!$zoneTypes){
			$zoneTypes = Config::get('system.zone_type');
		}

		$types = array();
		foreach($zoneTypes as $idx => $zone){
			$key = intval($zonetype & $idx);
			if(isset($zoneTypes[$key])){
				$types[] = $zoneTypes[$key];
			}
		}

		return join('、', $types);
	}
?>
